package edu.arizona.sista.learn.model.motion;

import java.util.List;

import edu.arizona.sista.learn.model.motion.Track;

public class PathWeight {
	public List<Track> _path;
	public double _weight;
	
	public PathWeight(List<Track> path, double weight) {
		_path = path;
		_weight = weight;
	}

	public int size() {
		return _path.size();
	}

	public double[] getSecondToLastVector() {
		int n = _path.size() - 1;
		double[] p1 = _path.get(n - 2).pos;
		double[] p2 = _path.get(n - 1).pos;
		return new double[]{p2[0] - p1[0], p2[1] - p1[1]};
	}
	
	public double[] getLastVector() {
		int n = _path.size() - 1;
		double[] p1 = _path.get(n - 1).pos;
		double[] p2 = _path.get(n).pos;
		return new double[]{p2[0] - p1[0], p2[1] - p1[1]};
	}

	public void removeLastPoint() {
		_path.remove(_path.size() - 1);
	}

}
